<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add Issue</title>

<script type="text/javascript" src="../jquery/jquery-1.7.2.min.js"></script>

<!-- Bootstrap -->
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
	type="text/javascript"></script>
<link href="../twbootstrap/css/bootstrap.min.css" rel="stylesheet"
	media="screen">
<link href="../twbootstrap/css/bootstrap-responsive.min.css"
	rel="stylesheet" media="screen">
<script src="../twbootstrap/js/bootstrap.min.js"></script>
<script src="../twbootstrap/js/bootstrap-dropdown.js"></script>




<!--  JQuery  -->
<script type="text/javascript" src="../jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="../jquery/jquery-ui-1.8.20.custom.min.js"></script>
<link type="text/css"
	href="../jquery/smoothness/jquery-ui-1.10.1.custom.css"
	rel="stylesheet" />
<link type="text/css"
	href="../jquery/smoothness/jquery-ui-1.10.1.custom.min.css"
	rel="stylesheet" /> 



<!-- CKEditor -->
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<link type="text/css" href="../styles/style.css" rel="stylesheet" /> 

<!--  Chosen -->
<script type="text/javascript" src="chosen/chosen.jquery.js"></script>


<link rel="stylesheet" href="chosen/chosen.css" />
<style type="text/css" media="all">
/* fix rtl for demo */
.chzn-rtl .chzn-search {
	left: -9000px;
}

.chzn-rtl .chzn-drop {
	left: -9000px;
}
</style>



<link href="../twbootstrap/css/bootstrap-responsive.min.css"
	rel="stylesheet" media="screen">
	


<script type="text/javascript" charset="utf-8">
	
	$(document)
			.ready(
					function() {
						$("#btnsave")
								.click(
										function() {

											var htmltext = CKEDITOR.instances.issuedetails
													.getData();
											//alert("Content: "+ htmltext);
											$
													.ajax({
														type : "post",
														url : "../addissue",
														datatype : "json",
														data : "issuetitle="
																+ $(
																		"#issuetitle")
																		.val()
																+ "&bugid="
																+ $("#bugid")
																		.val()
																+ "&version="
																+ $("#version")
																		.chosen()
																		.val()
																+ "&module="
																+ $("#module")
																		.chosen()
																		.val()
																+ "&issuedetails="
																+ escape(htmltext),
														success : function(data) {
															if (data.issueinfo.length > 0) {
																var issueid = data.issueinfo[0].issueid
																alert("Issueid: "
																		+ issueid);
																window.location = "viewissue.jsp?issueid="
																		+ issueid;
															} else {
																Alert("Error saving issue");
															}
														},
														error : function(jqXHR,
																textStatus) {
															alert("Request failed: "
																	+ textStatus);
														}
													});
										});

					});
</script>


</head>
<body>

<%@include file="header.jsp"%>


	<input type="hidden" id="articleid" name="articleid"
		value="<%=request.getParameter("articleid")%>">


	<div style="width: 85%; padding-left: 8%">
		<div>
			<br /> Title: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
				type="text" id="issuetitle" class="span8" name="issuetitle" value=""
				size="150"
				style="padding-left: 3px; padding-top: 3px; padding-bottom: 3px" />

			<em>&nbsp;&nbsp; &nbsp; &nbsp; Bugid: &nbsp;<input class="span2"
				type="text" style="width: 100px;" tabindex="4" id="bugid">

				<div class="side-by-side clearfix" style="padding-top: 20px;">

					<em>Module: &nbsp;</em> <select id="module"
						data-placeholder="Select a Module..." class="chzn-select"
						style="width: 350px;" tabindex="2">
						<option value=""></option>
						<option value="EMR">EMR</option>
						<option value="Patient Portal">Patient Portal</option>
						<option value="Surescripts">Surescripts & RxHub</option>
						<option value="eClinicalMessenger">eClinicalMessenger</option>
						<option value="eBO">eBO</option>
						<option value="FAX">FAX</option>
						<option value="eClinicalTouch">eClinicalTouch</option>
					</select> <em>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; Version:&nbsp;</em> <select
						data-placeholder="Select version..." class="chzn-select" multiple
						style="width: 350px;" tabindex="4" id="version">
						<option value=""></option>
						<option value="9.0">9.0</option>
						<option value="9.0.47">9.0.47</option>
						<option value="9.0.48">9.0.48</option>
						<option value="9.0.open">9.0.open</option>
						<option value="9.0.130">9.0.130</option>
					</select>


				</div> <br /> <br /> <textarea id="issuedetails" rows="30" cols="83"
					style="font-size: 14px; background-color: #f9f9f9;"></textarea> <br />
				<input type="submit" id="btnsave" value="save" name="btnsave"
				class="btn" /> &nbsp;&nbsp;&nbsp; <input type="submit"
				id="btncancel" value="cancel" name="btncancel" class="btn" />
		</div>







		<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
		<script type="text/javascript">
			var config = {
				'.chzn-select' : {},
				'.chzn-select-deselect' : {
					allow_single_deselect : true
				},
				'.chzn-select-no-single' : {
					disable_search_threshold : 10
				},
				'.chzn-select-no-results' : {
					no_results_text : 'Oops, nothing found!'
				},
				'.chzn-select-width' : {
					width : "95%"
				}
			}
			for ( var selector in config) {
				$(selector).chosen(config[selector]);
			}
		</script>



		<script type="text/javascript">
			CKEDITOR
					.replace(
							'issuedetails',
							{
								filebrowserBrowseUrl : '/ckfinder/ckfinder.html',
								filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?type=Images',
								filebrowserFlashBrowseUrl : '/ckfinder/ckfinder.html?type=Flash',
								filebrowserUploadUrl : 'uploadfileservlet?module=KB',
								filebrowserImageUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images',
								filebrowserFlashUploadUrl : '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash'
							});
			
			$('.dropdown-toggle').dropdown();

		</script>
</body>
</html>